'use strict'

module.exports = app => {
  const { router, controller, config, middleware } = app
  router.resources('home', '/api/v1', controller.home)
  router.resources('server', '/api/v1/server', controller.server)
  router.resources('stream', '/api/v1/stream', controller.stream)
  router.post('/api/v1/upstream_public', controller.stream.stash)
  router.resources('error', '/api/v1/error', controller.error)
  router.resources('rule', '/api/v1/rule', controller.rule)

  router.resources('action', '/api/v1/action', controller.action)
  router.resources('application', '/api/v1/application', controller.application)
  router.resources('log', '/api/v1/log', controller.log)
  router.resources('user', '/api/v1/user', controller.user)

  router.get('/api/v1/status', controller.home.status)
  router.get('/api/v1/status_all', controller.home.statusAdmin)
  // select
  router.get('/api/v1/select/user', controller.select.user)
  router.get('/api/v1/select/action', controller.select.action)
  router.get('/api/v1/select/server', controller.select.server)

  router.post('/api/v1/login', controller.user.login)
  router.post('/api/v1/register', controller.user.register)
  router.put('/api/v1/register/:id/password', controller.user.changePassword)

  router.get('/api/v1/setting', controller.home.showConfig)
  router.put('/api/v1/setting', controller.home.updateConfig)

}
